import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

/**
 * 没必要建立 底部common 它只是跟index 页面，其他页面不跟随。跟随的页面是StatefulWidget
 * @author hanson
 * @version[创立日期，2023/9/12 17:02]
 * @function[功用简介 ]
 **/
class CommonBottomBar extends StatelessWidget {
  const CommonBottomBar({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    int _selectedIndex = 0;
    return BottomAppBar(
      shape: const CircularNotchedRectangle(),
      elevation: 16,
      child: BottomNavigationBar(
        backgroundColor: Colors.transparent,
        elevation: 0,
        items: const [
          BottomNavigationBarItem(
            icon: Icon(CupertinoIcons.house),
            activeIcon: Icon(CupertinoIcons.house_fill),
            label: '首页',
          ),
          BottomNavigationBarItem(
            icon: Icon(CupertinoIcons.doc_text),
            activeIcon: Icon(CupertinoIcons.doc_text_fill),
            label: '日志',
          ),
          BottomNavigationBarItem(icon: SizedBox(), label: ''),
          BottomNavigationBarItem(
            icon: Icon(CupertinoIcons.collections),
            activeIcon: Icon(CupertinoIcons.collections_solid),
            label: '作品',
          ),
          BottomNavigationBarItem(
            icon: Icon(CupertinoIcons.person_alt_circle),
            activeIcon: Icon(CupertinoIcons.person_alt_circle_fill),
            label: '会员',
          )
        ],
        currentIndex: _selectedIndex,//配置默认选中的菜单，从下标零开始
        //selectedItemColor: Colors.blue,
        onTap: _onItemTapped,
        type: BottomNavigationBarType.fixed,
        //unselectedItemColor: Colors.grey,
        selectedFontSize: 12,
        unselectedFontSize: 12,
        showUnselectedLabels: true,
      ),
    );
  }

  void _onItemTapped(index) {

  }
}